package com.wuyancheng.blog.mapper;

import com.wuyancheng.blog.pojo.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ArticleMapper{

    /**
     * 分页查询文章
     * @param begin
     * @param pageSize
     * @return
     */
    @Select("select * from t_article order by id asc limit #{begin},#{pageSize}")
    List<Article> selectAll(@Param("begin") int begin, @Param("pageSize") int pageSize);

    /**
     * 统计总量
     * @return
     */
    @Select("select count(1) as count from t_article")
    int countArticle();
}
